<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<title>投票结果</title>
	<link type="text/css" rel="stylesheet" href="../css/style.css" />
</head>
<body>
<jsp:include page="top.jsp" />
<div id="vote" class="wrap">
	<h2>查看投票</h2>
	<ul class="list">
		<c:choose>
			<c:when test="${not empty voteSubjectId.items}">
				<h4>${voteSubjectId.vsTitle}</h4>
				<p class="info">共有 ${fn:length(voteSubjectId.options)} 个选项，已有${fn:length(voteSubjectId.items)} 个网友参与了投票</p>
				<ol>
					<c:forEach items="${voteSubjectId.options}" var="option" varStatus="i">
						<li>
								${option.voOption}
							<div class="ratebg">
								<div class="percent" style="width: ${fn:length(option.voItems) / fn:length(voteSubjectId.items) * 100}%;"></div>
							</div>
							<c:if test="${fn:length(voteSubjectId.items) > 0}">
								<p>${fn:length(option.voItems)} <span>(<fmt:formatNumber type="number" value="${fn:length(option.voItems) / fn:length(voteSubjectId.items) * 100}" maxFractionDigits="2"/>%)</span></p>
							</c:if>
							<c:if test="${fn:length(voteSubjectId.items) == 0}">
								<p>${fn:length(option.voItems)} <span>(0.00%)</span></p>
							</c:if>
						</li>
					</c:forEach>
				</ol>
			</c:when>
			<c:otherwise>
				<div class="status">抱歉暂时还没有人参加投票，欢迎您的加入！</div>
			</c:otherwise>
		</c:choose>
	</ul>
</div>
<div id="footer" class="wrap">
	北大青鸟 &copy; 版权所有
</div>
</body>
</html>